package service

import (
	"im-tools/internal/model"
	"im-tools/pkg"
)

// 用户服务
type UserService struct {
}

func (us *UserService) UserInfo(uid string) *model.UserModel {
	user := &model.UserModel{}
	pkg.MysqlDB.First(user, "fake_uid = ?", uid)
	return user
}

// 查询指定数量的用户
func (us *UserService) SelectUsers(count int) []model.UserModel {
	var users []model.UserModel
	pkg.MysqlDB.Limit(count).Find(&users)
	return users
}

// 根据手机号模糊查询用户
func (uc *UserService) SelectUsersLike(phone string) []model.UserModel {
	var users []model.UserModel
	pkg.MysqlDB.Where("phone LIKE ?", phone+"%").Find(&users)
	return users
}
